package innerClass.LocalInnerClass;

public class LocalInnerClass {
    public static void main(String[] args) {
        Outer outer = new Outer(100);
        outer.m1();
        System.out.println(outer.hashCode());
    }
}

class Outer {
    private int n1 = 100;

    public Outer(int n1) {
        this.n1 = n1;
    }

    private void m2() {
        System.out.println("Outer:m2()");
    } //私有方法

    public void m1() {
        String name = "xxx";
        final class Inner { //局部内部类
            //可以访问外部类的所有成员和方法(包括私有)
            private int n1 = 10;

            public void f1() {
                System.out.println("n1=" + n1);
                System.out.println("Outer n1=" + Outer.this.n1);
                System.out.println("Outer.this hashCode" + Outer.this.hashCode());
                m2();
            }
        }
        Inner inner = new Inner();
        inner.f1();
    }
}
